<!DOCTYPE html>
<html>
	<head>

		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>后台 - 推广查询</title>
		<meta name="keywords" content="">
		<meta name="description" content="">

		<link rel="shortcut icon" href="favicon.ico">
		<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css">
		<link href="__PUBLIC__/Admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
		<link href="__PUBLIC__/Admin/css/plugins/iCheck/custom.css" rel="stylesheet">
		<link href="__PUBLIC__/Admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">

	</head>
	<style>
		/*分页样式*/
		.pages a,.pages span {
		    display:inline-block;
		    padding:4px 7px;
		    margin:0 2px;
		    border:1px solid #D5D4D4;
		    -webkit-border-radius:1px;
		    -moz-border-radius:1px;
		    border-radius:1px;
		}
		.pages a,.pages li {
		    display:inline-block;
		    list-style: none;
		    text-decoration:none; color:#3399ff;
		}
		
		.pages a:hover{
		    border-color:#3399ff;
		}
		.pages span.current{
		    background:#3399ff;
		    color:#FFF;
		    font-weight:700;
		    border-color:#3399ff;
		}
		.pages{
			text-align: center;
		}
		/*分页样式*/
		
		.layui-layer{
			top:48px !important;
		}
	</style>
	<body class="gray-bg">
		<div class="wrapper wrapper-content animated fadeInRight">	
			<div class="row">
				<div class="col-sm-12">
					<div class="ibox float-e-margins">
						<div class="ibox-title">
							<h5>推广查询</h5>
						</div>
						<div class="ibox-content">
							<div class="row">
								<div class="col-sm-12">
									<form method="get" class="form-horizontal m-t" action="{:U('Admin/Agent/index')}">
	                                    <div class="form-group">
	                                        <div class="col-sm-12">
	                                            <input placeholder="开始日期" class="form-control layer-date" name="starttime" id="start">
	                                            <input placeholder="结束日期" class="form-control layer-date" name="endtime" id="end">
	                                        	<input style="margin-top: 16px;" type="submit" class="btn btn-primary" value="搜索"/>
	                                        </div>
	                                    </div>
                                	</form>
								</div>
							</div>
							<div class="" >
								<table class="table table-striped table-hover table-bordered" style="width:auto;overflow:auto;display:inline-block;">
									<thead>
										<tr>
											<th>推广ID</th>
											<th>代理名称</th>
											<if condition="$Think.session.admin.agent_rank neq 2">
												<th>代理类型</th>
											</if>
											<if condition="$Think.session.admin.agent_rank neq 2">
												<th>推广代理</th>
											</if>
											<th>推广会员</th>
											<th>上分</th>
											<th>下分</th>
											<th>进项</th>
											<th>出项</th>
											<th>推广奖励</th>
											<th>已结奖励</th>
											<th>剩余奖励</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
										<if condition="$Think.session.admin.role_id eq 0 || $Think.session.admin.agent_rank eq 1">
											<volist name="list" id="vo">
												<tr>
													<!-- <td width="20"><input type="checkbox" class="i-checks" name="ids[]"></td> -->
													<td width="60">{$vo.id}</td>
													<td width="100">{$vo.nickname}</td>
													<td width="100">
														<if condition="$vo.agent_rank eq 1">一级代理<else/>二级代理</if>
													</td>
													<td width="100">{$vo.people_agent|default=0}</td>
													<td width="100">{$vo.people|default=0}</td>
													<td width="100">{$vo.add_points|default=0}</td>
													<td width="100">{$vo.del_points|default=0}</td>
													<td width="100">{$vo.add|default=0}</td>
													<td width="100">{$vo.del|default=0}</td>
													<td width="100">{$vo.fan|default=0}</td>
													<td width="100">
														{$vo.delpoints|default=0}
													</td>
													<td width="100">
														{$vo['fan']-$vo['delpoints']}
													</td>
													<td>
														<if condition="$Think.session.admin.role_id eq 0">
															<a onclick="under('{$vo.id}','{$vo['fan']-$vo['delpoints']}')" class="btn btn-primary">结算</a>	
															<if condition="$vo.agent_rank neq 2">
																<a href="__APP__/Admin/Agent/xiajia_agent/id/{$vo.id}" class="btn btn-primary">下级代理</a>
															</if>	
														</if>
														<a href="__APP__/Admin/Agent/xiajia/id/{$vo.id}" class="btn btn-primary">下级玩家</a>
													</td>
												</tr>
											</volist>
											<else/>
											<tr>
												<!-- <td width="20"><input type="checkbox" class="i-checks" name="ids[]"></td> -->
												<td width="60">{$list.id}</td>
												<td width="100">{$list.nickname}</td>
												<td width="100">{$list.people|default=0}</td>
												<td width="200">{$list.add_points|default=0}</td>
												<td width="200">{$list.del_points|default=0}</td>
												<td width="200">{$list.add|default=0}</td>
												<td width="200">{$list.del|default=0}</td>
												<td width="200">{$list.fan|default=0}</td>
												<td width="200">
													{$list.delpoints|default=0}
												</td>
												<td width="200">
													{$list['fan']-$list['delpoints']}
												</td>
												<td>
													<if condition="$Think.session.admin.role_id eq 0">
														<a onclick="under('{$list.id}','{$list['fan']-$list['delpoints']}')" class="btn btn-primary">结算</a>	
													</if>
													<a href="__APP__/Admin/Agent/xiajia/id/{$list.id}" class="btn btn-primary">查看下家</a>	
													
												</td>
											</tr>
										</if>
									</tbody>
								</table>
							</div>
							<div class="pages">
								{$show}
							</div>
						</div>
					</div>
				</div>

			</div>
		</div>
		<script src="__PUBLIC__/Admin/js/jquery.min.js?v=2.1.4"></script>
		<script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
		<script src="__PUBLIC__/Admin/js/plugins/iCheck/icheck.min.js"></script>
		<script src="__PUBLIC__/Common/layer/layer.js"></script>
		<script src="__PUBLIC__/Admin/js/plugins/layer/laydate/laydate.js"></script>
		<script src="__PUBLIC__/Common/layer/layer.js"></script>
		<script>
			function under(id,points){
				layer.open({
			      	type: 2,
			      	title: '代理结算',
			      	shadeClose: true,
			      	shade: false,
			     	maxmin: true, //开启最大化最小化按钮
			      	area: ['300px', '500px'],
			      	content: "__APP__/Admin/Agent/under/id/" + id + '/points/'+ points +""
			    });
			}
			var start = { 
					elem: "#start", 
					format: "YYYY-MM-DD hh:mm:ss", 
					min: '', 
					max: laydate.now(), 
					istime: true, 
					istoday: false, 
					choose: function(datas) { 
						end.min = datas;
						end.start = datas 
					}
			};
			var end = { 
				elem: "#end", 
				format: "YYYY-MM-DD 23:59:59", 
				min: '', 
				max: laydate.now(), 
				istime: true, 
				istoday: false, 
				choose: function(datas) { 
					start.max = datas 
				}
			};
			laydate(start);
			laydate(end);
		</script>
	</body>

	
</html>